package www.test.service;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import www.test.bean.ShipInfo;
import www.test.dao.ShipDao;
import www.test.servlet.InfoServlet;

public class ShipService
{

	public static List<HashMap<String, ?>> getShipInfoList(HttpServletRequest request, HttpServletResponse response, ShipInfo domain) throws SQLException
	{
		List<HashMap<String, ?>> list =ShipDao.getShipInfoList(request,response,domain);
		if(list.size()>0)
		{
			Object pages = list.get(0).get("PAGE_ITEM_COUNT");
			
				domain.setRecordCount(Integer.parseInt(String.valueOf(pages)));
			
		}
		else 
		{
			
			domain.setRecordCount(0);
		}
		
		return  list;
	}

	public static boolean doSave(HttpServletRequest request, HttpServletResponse response, ShipInfo domain) throws SQLException
	{
		return ShipDao.doSave(request,response,domain);
	}

	public static HashMap<String, ?> getShipById(HttpServletRequest request, HttpServletResponse response, ShipInfo domain) throws SQLException
	{
		return ShipDao.getShipById(request,response,domain);
	}

	public static boolean delete(HttpServletRequest request, HttpServletResponse response, ShipInfo domain) throws SQLException
	{
		return ShipDao.delete(request,response,domain);
	}

}
